package com.chencq.module.permission.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chencq.core.dao.BaseDao;
import com.chencq.core.service.base.impl.BaseServiceImpl;
import com.chencq.module.permission.entity.Permission;
import com.chencq.module.permission.service.PermissionService;

@Service
public class PermissionServiceImpl extends BaseServiceImpl<Permission>
		implements PermissionService {

	@Autowired
	private BaseDao<Permission> permissionDao;

	@Override
	public List<Permission> findByUserId(String userId) {
		String hql = "SELECT c FROM UserRefRole a,RoleRefPermission b,Permission c "
					+ "WHERE a.userId='"+userId
					+"' AND a.roleId=b.roleId  "
					+"  AND b.permissionId=c.permissionId";
		return permissionDao.find(hql);
	}

}
